home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- //
-
- global proc breakRigidBodyConnections()
- //
- // This proc deletes all the connections to a rigid body that are not connections
- // from the solver.
- //
- {
- int $i, $j, $k;
- string $selObj[] = `ls -sl`;
-
- // For each object in the selection list, check to see if
- // and rigid bodies are present.
- //
- for ($i = 0; $i < size( $selObj ); $i++)
- {
- // Get a list of selected items and thier children.
- //
- string $kids[] = `ls -dag -leaf -showType $selObj[$i]`;
-
- // Check to see if we have any rigid bodies.
- //
- for ($j = 0; $j < size( $kids ); $j += 2)
- {
- // If a rigid body is found process it.
- //
- if ($kids[$j+1] == "rigidBody")
- {
- string $rigidName = $kids[$j] + ".choice";
- string $bakeSimIndex = $kids[$j] + ".bakeSimulationIndex";
-
- string $choiceList[] = `connectionInfo -dfs $rigidName`;
-
- // Get the choice node.
- //
- for ( $k = 0; $k < size( $choiceList ); $k++ )
- {
- string $choiceNode[] = `ls -o $choiceList[$k]`;
- string $destination = $choiceNode[0] + ".input[1]";
- string $source = `connectionInfo -sfd $destination`;
-
- if ( ( size( $source ) > 0 ) && ( size( $destination ) > 0 ) )
- {
- disconnectAttr $source $destination;
- }
-
- $destination = $choiceNode[0] + ".input[2]";
- $source = `connectionInfo -sfd $destination`;
-
- if ( ( size( $source ) > 0 ) && ( size( $destination ) > 0 ) )
- {
- disconnectAttr $source $destination;
- }
- }
-
- // If there is a connection to the bake sim attribute then we have
- // been baked. Disconnect the connection to this attribute.
- //
- if ( $bakeSimIndex != -1 )
- {
- string $source = `connectionInfo -sfd $bakeSimIndex`;
-
- if ( ( size( $source ) > 0 ) && ( size( $bakeSimIndex ) > 0 ) )
- {
- disconnectAttr $source $bakeSimIndex;
- }
-
- // Reset the bake sim index.
- //
- setAttr $bakeSimIndex -1;
- }
- }
- }
- }
- }
-